package Thread_;

public class Thread09 {
    public static void main(String[] args) throws InterruptedException {
        //线程终止 2
       Thread t= new Thread(()->{
            while(!Thread.currentThread().isInterrupted()){
                System.out.println("Thread线程正在执行!!");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
//                    throw new RuntimeException(e);
//                    break;
                }
            }
           System.out.println("Thread线程结束!");
        });
       t.start();
       t.sleep(3000);
       t.interrupt();
        System.out.println("3s后 main线程结束!!");
    }
}
